/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ro.hex.remocadm.telnet.commands;

import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.Logger;
import ro.hex.remocadm.telnet.TelnetNotifier;
import ro.hex.remocadm.telnet.TelnetThread;

/**
 * Sends the 'setup option' to set the 'dshow-tuner-channel'. The value of the
 * channel is taken from the 'vlc.channel' parameter from the context.
 * 
 * @author Iulian Virtejanu
 */
public class SetDxChannelCommand extends TelnetThread {

    private Logger logger = Logger.getLogger(SetDxChannelCommand.class);

    public SetDxChannelCommand(TelnetNotifier parent, Properties context) {
        super(parent, context);
    }

    @Override
    public void telnetDialog() throws IOException {
        writeLine("control " + getParameter("vlc.admin.stream.name") + " stop");
        readUntil("> ");
        writeLine("setup " + getParameter("vlc.admin.stream.name") + " option :dshow-tuner-channel=" + getParameter("vlc.channel"));
        readUntil("> ");
        writeLine("control " + getParameter("vlc.admin.stream.name") + " play");
        readUntil("> ");
    }
}
